XtGem Forum catalog

Modifiers are keywords that you add to those definitions to change their meanings. The Java language has a wide variety of modifiers, including the following:

To use a modifier, you include its keyword in the definition of a class, method, or variable. The modifier precedes the rest of the statement, as in the following examples (Italic ones):

publicclass className {// ...}privateboolean myFlag;staticfinaldouble weeks =9.5;protectedstaticfinalint BOXWIDTH =42;publicstaticvoid main(String[] arguments){// body of method}

Access Control Modifiers:

Java provides a number of access modifiers to set access levels for classes, variables, methods and constructors. The four access levels are:

Non Access Modifiers:

Java provides a number of non-access modifiers to achieve many other functionality.